from config import HOST
from tools import log


class ApiRecharge:
    def __init__(self,session):
        self.session=session
        self.__url_code=HOST+"/common/public/verifycode/{}"
        self.__url_recharge=HOST+"/trust/trust/recharge"

    def api_img_code(self,random):
        log.info("正在调用充值验证码接口，请求方法get ß请求url:{}".format(self.__url_code.format(random)))
        return self.session.get(url=self.__url_code.format(random))

    def api_recharge(self):
        data={
            "paymentType": "chinapnrTrust",
            "amount": 10000,
            "formStr": "reForm",
            "valicode": "8888"
        }
        log.info("正在调用后台充值接口，请求方法post 请求url:{} 请求参数：{}".format(self.__url_recharge,data))
        return self.session.post(url=self.__url_recharge,data=data)